<?php

namespace App\Providers;

use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Schema;
use Laravel\Dusk\DuskServiceProvider;
use App\Models\Entity\content_audit\content_audit;
use App\Models\Entity\Asset\Video\Vasseti;
use App\Observers\ContentAuditObserver;
use App\Observers\VassetiObserver;
use Illuminate\Database\Eloquent\Relations\Relation;
class AppServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
        // tian 解决执行 `php artisan migrate` 字符串长度报错问题
        Schema::defaultStringLength(191);
        content_audit::observe(ContentAuditObserver::class);
        Vasseti::observe(VassetiObserver::class);

        Relation::morphMap([
            'Vasseti' => 'App\Models\Entity\Asset\Video\Vasseti',
        ]);
    }

    /**
     * Register any application services.
     *
     * @return void
     */
    public function register()
    {
        // 浏览器测试 (Laravel Dusk)
        if ($this->app->environment('local', 'testing')) {
            $this->app->register(DuskServiceProvider::class);
        }
    }
}
